package linkedList;

import java.util.Iterator;
import java.util.LinkedList;

/**
 * 链表双向链表
 */
public class LinkedListDemo1 {
    public static void main(String[] args) {
        LinkedList<String> list = new LinkedList<>();
        list.add("aaa");
        list.add("bbb");
        list.add("ccc");

        for (int i = 0; i < list.size(); i++) {
            System.out.println(list.get(i));
        }
        System.out.println("--------------------------------");

        Iterator<String> it = list.iterator();
        while (it.hasNext()) {
            System.out.println(it.next());
        }
        System.out.println("--------------------------------");

        for (String str : list) {
            System.out.println(str);
        }
    }
}
